<?php
namespace Home\Controller;
use Think\Controller;
class GoodsController extends CommonController {
    public function lists(){

        $data = D('Admin/goods')->getBySelect();

        $this->assign('list',$data['list']);// 赋值数据集
        $this->assign('page',$data['show']);// 赋值分页输出

        $this->display();
    }

    /**
     * 商品详情
     *
     * @return void
     * @author
     **/
    function detail()
    {
        // print_r($_SESSION);die;
        $goods_id = I('get.id');

        //查询商品数据表
        $goods = D('Admin/goods')->relation('goods_img')->getById($goods_id);

        $type_id = $goods['goods_type_id'];
        //查询规格数据表
        $spec = D('Admin/spec')->where("goods_type_id = $type_id")->relation(true)->order('id asc')->select();
        // print_r($spec);die;
        $this->assign('goods',$goods);
        $this->assign('spec',$spec);

        $this->display();
    }
}